<template>
    <div>
        <van-nav-bar title="主页" />
        <van-swipe :autoplay="2000" lazy-render>
            <van-swipe-item v-for="image in images" :key="image">
                <img :src="image" style="width: 100%;height: 200px;" />
            </van-swipe-item>
        </van-swipe>
        <van-skeleton v-if="search.length == 0" title :row="3" />
        <div v-else v-for="item in search">
            <van-card :price="item.goods_price" :title="item.goods_name"
                :thumb="item.goods_big_logo ? item.goods_big_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
        </div>
    </div>
</template>

<script setup>
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
];
import { ref } from 'vue';
import { searchApi } from '@/api/api'
let search = ref([])
searchApi().then(res => {
    console.log('列表', res)
    search.value = res.data.message.goods
})
</script>

<style lang="scss" scoped></style>